<?php

namespace App\Kuafu\Shop\Model;

use App\Kuafu\Base\Model\BaseModel;
use App\Kuafu\Base\Model\Traits\KfSoftDeletes;

class SearchLogModel extends BaseModel
{
    use  KfSoftDeletes;

    protected $connection = 'mysqlDataStatistics';
    protected $table      = 'search_log';
    protected $primaryKey = 'id';
    protected $fillable   = [
        'id',
        'customerId',
        'shopId',
        'source',
        'content',
        'createdAt',
        'updatedAt',
        'isDeleted',
    ];

    const SOURCE_WX_APPLET = 1;

    const SOURCE_MAP_TEXT = [
        self::SOURCE_WX_APPLET => '微信点餐小程序搜索',
    ];


    public static function addData($data): bool
    {
        return self::query()->insert($data);
    }
}
